Skip to content

Conversation

cacieprins
Copy link
Contributor

@cacieprins cacieprins commented Oct 2, 2025

  • Closes

Additional details

System tests currently fetch typescript definitions and example payloads for API endpoints when they run. This ensures our api calls are supported properly by the server.

This adds the same functionality to packages/server, so we can make sure our api functions use up-to-date typedefs from Cypress Cloud

Steps to test

How has the user experience changed?

PR Tasks


Note

Adopts Cloud-provided validation types for server API requests/responses, adds a sync script and build hooks, and refactors record flow error handling with stricter typings.

  • Types & Cloud validations
    • Replace local request/response interfaces with Cloud validation types in lib/cloud/api/index.ts and lib/cloud/api/create_instance.ts (e.g., PostRun*, PostRunInstance*, PostInstanceResults*).
    • Add typing to various API methods (ping, getAuthUrls, createInstance, postInstanceTests, updateInstanceStdout, updateInstanceArtifacts, postInstanceResults, etc.).
    • Gate protocol setup by options.testingType and add local PutInstanceArtifactsResponseType alias.
  • Record flow adjustments
    • Refactor _postInstanceTests in lib/modes/record.ts to async/await with try/catch using cloudCannotProceedErr.
    • Update onTestsReceived to handle failures via try/catch and skip logic; emit project.emit('end', { skippedSpec: true }) on skip.
  • Build/scripts
    • Add scripts/sync-cloud-validations.sh and npm scripts sync-cloud-validations, ensure-cloud-validations; run during postinstall and before TypeScript (build-prod, check-ts).
    • Add dependency zod and ignore generated lib/validations in .gitignore.

Written by Cursor Bugbot for commit d7e2dd8. This will update automatically on new commits. Configure here.

Copy link

cypress bot commented Oct 2, 2025

cypress    Run #66300

Run Properties:  status check failed Failed #66300  •  git commit d7e2dd8939: Merge branch 'develop' into chore/use-api-typedefs
Project cypress
Branch Review chore/use-api-typedefs
Run status status check failed Failed #66300
Run duration 43m 47s
Commit git commit d7e2dd8939: Merge branch 'develop' into chore/use-api-typedefs
Committer Cacie Prins
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
Tests that were flaky  Flaky 15
Tests that did not run due to a developer annotating a test with .skip  Pending 1102
Tests that did not run due to a failure in a mocha hook  Skipped 4
Tests that passed  Passing 26706
View all changes introduced in this branch ↗︎

Warning

Partial Report: The results for the Application Quality reports may be incomplete.

UI Coverage  45.27%
  Untested elements 186  
  Tested elements 158  
Accessibility  97.99%
  Failed rules  4 critical   8 serious   2 moderate   2 minor
  Failed elements 100  

Tests for review

Failed  cypress/e2e/studio/studio.cy.ts • 1 failed test • app-e2e

View Output

Test Artifacts
Cypress Studio > updates an existing test with assertions Test Replay Screenshots
Flakiness  e2e/origin/config_env.cy.ts • 1 flaky test • 5x-driver-electron

View Output

Test Artifacts
cy.origin- Cypress.config() > serializable > overwrites different values in secondary if one exists in the primary Test Replay
Flakiness  issues/28527.cy.ts • 1 flaky test • 5x-driver-electron

View Output

Test Artifacts
issue 28527 > fails and then retries and verifies about:blank is not displayed Test Replay Screenshots
Flakiness  commands/window.cy.js • 1 flaky test • 5x-driver-firefox

View Output

Test Artifacts
... > only logs once
    </td>
  </tr></table>
Flakiness  commands/files.cy.js • 1 flaky test • 5x-driver-firefox

View Output

Test Artifacts
src/cy/commands/files > #readFile > retries to read when ENOENT
    </td>
  </tr></table>
Flakiness  issues/28527.cy.ts • 1 flaky test • 5x-driver-firefox

View Output

Test Artifacts
issue 28527 > fails and then retries and verifies about:blank is not displayed Screenshots

The first 5 flaky specs are shown, see all 13 specs in Cypress Cloud.

@cacieprins cacieprins marked this pull request as ready for review October 3, 2025 15:09
@cacieprins cacieprins self-assigned this Oct 3, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

return cb(response)
} catch (err: unknown) {
onError(err)
debug('postInstanceTests failed, allowing browser to hang until it is killed: Error %o', { err })
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Error Handling Fails to Return Early After API Failure

The refactored error handling for _postInstanceTests in onTestsReceived is missing an explicit return statement in its catch block. This causes the function to continue executing after an API failure instead of returning early, which alters the intended behavior of letting the browser hang.

Fix in Cursor Fix in Web

.catch((err: any) => {
onError(err)

return responseDidFail
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we no longer need this logic?

"dev": "node index.js",
"docker": "cd ../.. && WORKING_DIR=/packages/server ./scripts/run-docker-local.sh",
"postinstall": "patch-package",
"postinstall": "patch-package && yarn sync-cloud-validations",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are doing this at the package level, do we still need to call it in CI after the build? Would be nice to get rid of this https://github.com/cypress-io/cypress/blob/develop/.circleci/src/pipeline/@pipeline.yml#L201

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants